/*
 *  cube.h
 *  Ray Tracer
 *
 *  Created by Chirantan Ekbote on 11/9/10.
 *  Copyright 2010 Ohio State University. All rights reserved.
 *
 */

#ifndef _CUBE_H_
#define _CUBE_H_

#ifdef  __cplusplus
extern "C" {
#endif	// __cplusplus

#include <math.h>
#include "param.h"
#include "vec3.h"
#include "rgb.h"
#include "ray.h"
#include "light.h"

struct object;

typedef struct cube {
	vec3 pos;
	float width;
	float height;
	float depth;
	rgb ambientColor;
	rgb diffuseColor;
	float shininess;
	float transparency;
} cube;

static inline cube makeCube(const vec3 p, const float w, const float h, const float d, 
							const rgb ambient, const rgb diffuse, const float s, const float t) {
	cube temp = {p, w, h, d, ambient, diffuse, s, t};
	return temp;
}
		
// Returns 0 if miss, 1 if hit and stores time in t
int cubeHit(const cube* cu, const ray* r, double* t);

rgb cubeOnHit(const cube* cu, const ray* r, const vec3 hitPos, const struct object* shapes, 
			  const light* lights, int depth, const param* p);

#ifdef  __cplusplus
}
#endif	// __cplusplus
#endif // _CUBE_H_